package com.chenglu.android.mine.member.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chenglu.android.R;
import com.chenglu.android.common.utils.GlideUtils;
import com.chenglu.android.common.utils.Utils;
import com.chenglu.android.common.widget.RadiusImageView;
import com.chenglu.android.mine.bean.CollectBean;
import com.chenglu.android.mine.bean.FansListBean;
import com.chenglu.android.mine.collect.adapter.CouponListAdapter;

import java.util.List;

/**
 * @author: lyj
 * @Created: by Copyright 2023/7/24 Guangzhou Hongma Technology Co., Ltd. All rights reserved.
 * @Description：粉丝列表
 */
public class FansListAdapter extends BaseQuickAdapter<FansListBean.Data.Records, BaseViewHolder> {

    private Context mContext;

    private  int mFansType;
//    private final ViewBinderHelper viewBinderHelper = new ViewBinderHelper();

    public FansListAdapter(Context context, int layoutResId, @Nullable List<FansListBean.Data.Records> data,int fanstype) {
        super(layoutResId, data);
        this.mContext = context;
        this.mFansType = fanstype;

    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, FansListBean.Data.Records item) {

        if (item == null) {
            return;
        }
        TextView tvPrice = helper.getView(R.id.tv_item_consume_price);
        TextView tvitemTime = helper.getView(R.id.tv_item_time);

        if(mFansType == 1 ){
            tvPrice.setVisibility(View.GONE);
            tvitemTime.setVisibility(View.VISIBLE);
            tvitemTime.setText(item.getCreateTime());

        }else {
            tvPrice.setVisibility(View.VISIBLE);
            tvitemTime.setVisibility(View.GONE);
            tvPrice.setText(Utils.formatZeroNumber(item.getConsumptionAmount()));
        }
        helper.setText(R.id.tv_nickname,item.getNickName());
        helper.setText(R.id.tv_item_level,item.getLevelName());

        RadiusImageView imageView = helper.getView(R.id.iv_head_pic);
        GlideUtils.setImageView(mContext,item.getAvatar(),imageView,30);


    }
}
